package jdk8demo.interfacefunction;

import java.util.function.Consumer;
import java.util.function.Supplier;

//Supplier 延迟加载 传⼊入⼀一个泛型 返回⼀一个泛型T
//Customer 接收⼀一个泛型的参数T进行处理
public class SupplierConsumerDemo {

	public static void main(String[] args) {
		Supplier<Student> su = Student::new;
		Student s = su.get();
		s.setName("test");
		System.out.println(s.getName());

		Consumer<Integer> c1 = x -> {
			x = x + 2;
			System.out.println(x);
		};
		c1.accept(19);

		Consumer<Integer> c2 = x -> {
			System.out.println(x * 15);
		};

		c1.andThen(c2).accept(10);

	}
}

class Student {
	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}